{% extends "base.html" %}
{% load i18n %}
{% load user_timezone %}

{% block body%}
<table width="100%" cellpadding="0" cellspacing="0">
  <tr>
    <td align="right">
      <table cellpadding="2">
        <tr>
          <td></td>
          <td align="right">
            {% if mine_dropped %}
              <b>[<a href="/games/mine/dig/{{ request.path|urlencode }}">{% trans "Mine Gold" %}</a>]</b>
            {% endif %}
            [<a href="/p/add/{{ forum.key.id }}">{% trans "New Topic" %}</a>]
            [<a href="/f/{{ forum.key.id }}/{{ next_index }}">{% trans "Refresh" %}</a>]
            [<a href="/fav/add/{{ forum.key.id }}">{% trans "Add to Favourites" %}</a>]
            {% if admin_mode %}
              [<a href="/f/manage/{{ forum.key.id}}">{% trans "Manage" %}</a>]
            {% endif %}
            {% if next_index %}
              [<a href="/f/{{ forum.key.id }}/{{ next_index}">{% trans "Next Page" %}</a>]
            {% endif %}
          </td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td align="center">
      <!-- posts -->
      <table width="100%" cellspacing="2" class="posttable">
        <colgroup>
          <col width="*" align="left">
          <col width="50">
          <col width="50">
          <col width="160">
        </colgroup>
        <thead>
          <tr>
            <th>{% trans "Title" %}</th>
            <th>{% trans "Views" %}</th>
            <th>{% trans "Replies" %}</th>
            <th>{% trans "Last Reply" %}</th>
          </tr>
        </thead>
        <tbody>
          <!-- pinned threads -->
          {% for post in pinned %}
            <tr>
              <td>
                <div>
                  <a href="/t/{{ post.key.id }}/" class="posttitle">
                    {{ post.title }}
                  </a>
                  <font color="red">[{% trans "Pinned" %}]</font>
                  {% if post.is_recommended %}
                    <font color="red">[{% trans "Recommended" %}]</font>
                  {% endif %}
                  {% if post.is_locked %}
                    <font color="red">[{% trans "Locked" %}]</font>
                  {% endif %}
                </div>
                <a href="/u/{{post.author.key.name}}">
                  {% if post.author.nickname %}
                    {{ post.author.nickname }}
                  {% endif %}
                  [{{ post.author.user.email|slice:":6"}}...]
                </a>
                <span class="time">
                  ({{ post.post_time|user_timezone:time_zone|date:"Y-m-d H:i:s" }})
                </span>
              </td>
              <td align="center">{{ post.read_count }}</td>
              <td align="center">[+{{ post.reply_count }}]</td>
              <td>{{ post.last_reply|user_timezone:time_zone|date:"Y-m-d H:i:s" }}</td>
            </tr>
          {% endfor %}
          <!-- normal posts -->
          {% for post in posts %}
            <tr>
              <td>
                <div>
                  <a href="/t/{{ post.key.id }}/" class="posttitle">
                    {{ post.title }}
                  </a>
                  {% if post.is_recommended %}
                    <font color="red">[{% trans "Recommended" %}]</font>
                  {% endif %}
                  {% if post.is_locked %}
                    <font color="red">[Locked]</font>
                  {% endif %}
                </div>
                <a href="/u/{{post.author.key.name}}">
                  {% if post.author.nickname %}
                    {{ post.author.nickname }}
                  {% endif %}
                  [{{ post.author.user.email|slice:":6"}}...]
                </a>
                <span class="time">
                  ({{ post.post_time|user_timezone:time_zone|date:"Y-m-d H:i:s" }})
                </span>
              </td>
              <td align="center">{{ post.read_count }}</td>
              <td align="center">[+{{ post.reply_count }}]</td>
              <td>{{ post.last_reply|user_timezone:time_zone|date:"Y-m-d H:i:s" }}</td>
            </tr>
          {% endfor %}
        </tbody>
      </table>
    </td>
  </tr>
</table>
{% endblock %}